package com.dalong.springboot.bean;

import java.util.HashMap;

/**
 * Created by Administrator on 2018/11/28 0028.
 */
public class ResultMsg {

    private int code;
    private String msg;

    private HashMap<String ,Object> data=new HashMap<>();

    public static ResultMsg success(){
        ResultMsg  msg=new ResultMsg();
        msg.setCode(100);
        msg.setMsg("处理成功!");
        return msg;
    }

    public static ResultMsg error(){
        ResultMsg  msg=new ResultMsg();
        msg.setCode(200);
        msg.setMsg("处理失败!");
        return msg;
    }

    public  ResultMsg add(String key,Object msg){
        this.getData().put(key,msg);
        return this;
    }



    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }


    public HashMap<String, Object> getData() {
        return data;
    }

    public void setData(HashMap<String, Object> data) {
        this.data = data;
    }
}
